# This file is a part of Julia. License is MIT: https://julialang.org/license

"""
    struct TermCapability

Specification of a single terminal capability.

!!! warning
  This is not part of the public API, and thus subject to change without notice.

# Fields

- `short::Symbol`: The *Cap-name* of the capability
- `long::Symbol`: The name of the terminfo capability variable
- `description::String`: A description of the purpose of the capability

See also: `TermInfo`, `TERM_FLAGS`, `TERM_NUMBERS`, and `TERM_STRINGS`.
"""
struct TermCapability
    short::Symbol
    long::Symbol
    description::String
end

# Terminfo Capabilities as of NCurses 6.3

"""
Ordered list of known terminal capability flag fields, as of NCurses 6.3.
"""
const TERM_FLAGS = [
    TermCapability(:bw,    :auto_left_margin,         "cub1 wraps from column 0 to last column"),
    TermCapability(:am,    :auto_right_margin,        "terminal has automatic margins"),
    TermCapability(:xsb,   :no_esc_ctlc,              "beehive (f1=escape, f2=ctrl C)"),
    TermCapability(:xhp,   :ceol_standout_glitch,     "standout not erased by overwriting (hp)"),
    TermCapability(:xenl,  :eat_newline_glitch,       "newline ignored after 80 cols (concept)"),
    TermCapability(:eo,    :erase_overstrike,         "can erase overstrikes with a blank"),
    TermCapability(:gn,    :generic_type,             "generic line type"),
    TermCapability(:hc,    :hard_copy,                "hardcopy terminal"),
    TermCapability(:km,    :has_meta_key,             "Has a meta key (i.e., sets 8th-bit)"),
    TermCapability(:hs,    :has_status_line,          "has extra status line"),
    TermCapability(:in,    :insert_null_glitch,       "insert mode distinguishes nulls"),
    TermCapability(:db,    :memory_below,             "display may be retained below the screen"),
    TermCapability(:da,    :memory_above,             "display may be retained above the screen"),
    TermCapability(:mir,   :move_insert_mode,         "safe to move while in insert mode"),
    TermCapability(:msgr,  :move_standout_mode,       "safe to move while in standout mode"),
    TermCapability(:os,    :over_strike,              "terminal can overstrike"),
    TermCapability(:eslok, :status_line_esc_ok,       "escape can be used on the status line"),
    TermCapability(:xt,    :dest_tabs_magic_smso,     "tabs destructive, magic so char (t1061)"),
    TermCapability(:hz,    :tilde_glitch,             "cannot print ~'s (Hazeltine)"),
    TermCapability(:ul,    :transparent_underline,    "underline character overstrikes"),
    TermCapability(:xon,   :xon_xoff,                 "terminal uses xon/xoff handshaking"),
    TermCapability(:nxon,  :needs_xon_xoff,           "padding will not work, xon/xoff required"),
    TermCapability(:mc5i,  :prtr_silent,              "printer will not echo on screen"),
    TermCapability(:chts,  :hard_cursor,              "cursor is hard to see"),
    TermCapability(:nrrmc, :non_rev_rmcup,            "smcup does not reverse rmcup"),
    TermCapability(:npc,   :no_pad_char,              "pad character does not exist"),
    TermCapability(:ndscr, :non_dest_scroll_region,   "scrolling region is non-destructive"),
    TermCapability(:ccc,   :can_change,               "terminal can re-define existing colors"),
    TermCapability(:bce,   :back_color_erase,         "screen erased with background color"),
    TermCapability(:hls,   :hue_lightness_saturation, "terminal uses only HLS color notation (Tektronix)"),
    TermCapability(:xhpa,  :col_addr_glitch,          "only positive motion for hpa/mhpa caps"),
    TermCapability(:crxm,  :cr_cancels_micro_mode,    "using cr turns off micro mode"),
    TermCapability(:daisy, :has_print_wheel,          "printer needs operator to change character set"),
    TermCapability(:xvpa,  :row_addr_glitch,          "only positive motion for vpa/mvpa caps"),
    TermCapability(:sam,   :semi_auto_right_margin,   "printing in last column causes cr"),
    TermCapability(:cpix,  :cpi_changes_res,          "changing character pitch changes resolution"),
    TermCapability(:lpix,  :lpi_changes_res,          "changing line pitch changes resolution"),
    TermCapability(:OTbs,  :backspaces_with_bs,       "uses ^H to move left"),
    TermCapability(:OTns,  :crt_no_scrolling,         "crt cannot scroll"),
    TermCapability(:OTnc,  :no_correctly_working_cr,  "no way to go to start of line"),
    TermCapability(:OTMT,  :gnu_has_meta_key,         "has meta key"),
    TermCapability(:OTNL,  :linefeed_is_newline,      "move down with \n"),
    TermCapability(:OTpt,  :has_hardware_tabs,        "has 8-char tabs invoked with ^I"),
    TermCapability(:OTxr,  :return_does_clr_eol,      "return clears the line"),
]

"""
Ordered list of known terminal capability number fields, as of NCurses 6.3.
"""
const TERM_NUMBERS = [
    TermCapability(:cols,   :columns,                 "number of columns in a line"),
    TermCapability(:it,     :init_tabs,               "tabs initially every # spaces"),
    TermCapability(:lines,  :lines,                   "number of lines on screen or page"),
    TermCapability(:lm,     :lines_of_memory,         "lines of memory if > line. 0 means varies"),
    TermCapability(:xmc,    :magic_cookie_glitch,     "number of blank characters left by smso or rmso"),
    TermCapability(:pb,     :padding_baud_rate,       "lowest baud rate where padding needed"),
    TermCapability(:vt,     :virtual_terminal,        "virtual terminal number (CB/unix)"),
    TermCapability(:wsl,    :width_status_line,       "number of columns in status line"),
    TermCapability(:nlab,   :num_labels,              "number of labels on screen"),
    TermCapability(:lh,     :label_height,            "rows in each label"),
    TermCapability(:lw,     :label_width,             "columns in each label"),
    TermCapability(:ma,     :max_attributes,          "maximum combined attributes terminal can handle"),
    TermCapability(:wnum,   :maximum_windows,         "maximum number of definable windows"),
    TermCapability(:colors, :max_colors,              "maximum number of colors on screen"),
    TermCapability(:pairs,  :max_pairs,               "maximum number of color-pairs on the screen"),
    TermCapability(:ncv,    :no_color_video,          "video attributes that cannot be used with colors"),
    TermCapability(:bufsz,  :buffer_capacity,         "numbers of bytes buffered before printing"),
    TermCapability(:spinv,  :dot_vert_spacing,        "spacing of pins vertically in pins per inch"),
    TermCapability(:spinh,  :dot_horz_spacing,        "spacing of dots horizontally in dots per inch"),
    TermCapability(:maddr,  :max_micro_address,       "maximum value in micro_..._address"),
    TermCapability(:mjump,  :max_micro_jump,          "maximum value in parm_..._micro"),
    TermCapability(:mcs,    :micro_col_size,          "character step size when in micro mode"),
    TermCapability(:mls,    :micro_line_size,         "line step size when in micro mode"),
    TermCapability(:npins,  :number_of_pins,          "numbers of pins in print-head"),
    TermCapability(:orc,    :output_res_char,         "horizontal resolution in units per line"),
    TermCapability(:orl,    :output_res_line,         "vertical resolution in units per line"),
    TermCapability(:orhi,   :output_res_horz_inch,    "horizontal resolution in units per inch"),
    TermCapability(:orvi,   :output_res_vert_inch,    "vertical resolution in units per inch"),
    TermCapability(:cps,    :print_rate,              "print rate in characters per second"),
    TermCapability(:widcs,  :wide_char_size,          "character step size when in double wide mode"),
    TermCapability(:btns,   :buttons,                 "number of buttons on mouse"),
    TermCapability(:bitwin, :bit_image_entwining,     "number of passes for each bit-image row"),
    TermCapability(:bitype, :bit_image_type,          "type of bit-image device"),
    TermCapability(:OTug,   :magic_cookie_glitch_ul,  "number of blanks left by ul"),
    TermCapability(:OTdC,   :carriage_return_delay,   "pad needed for CR"),
    TermCapability(:OTdN,   :new_line_delay,          "pad needed for LF"),
    TermCapability(:OTdB,   :backspace_delay,         "padding required for ^H"),
    TermCapability(:OTdT,   :horizontal_tab_delay,    "padding required for ^I"),
    TermCapability(:OTkn,   :number_of_function_keys, "count of function keys"),
]

"""
Ordered list of known terminal capability string fields, as of NCurses 6.3.
"""
const TERM_STRINGS = [
    TermCapability(:cbt,      :back_tab,                  "back tab (P)"),
    TermCapability(:bel,      :bell,                      "audible signal (bell) (P)"),
    TermCapability(:cr,       :carriage_return,           "carriage return (P*) (P*)"),
    TermCapability(:csr,      :change_scroll_region,      "change region to line #1 to line #2 (P)"),
    TermCapability(:tbc,      :clear_all_tabs,            "clear all tab stops (P)"),
    TermCapability(:clear,    :clear_screen,              "clear screen and home cursor (P*)"),
    TermCapability(:el,       :clr_eol,                   "clear to end of line (P)"),
    TermCapability(:ed,       :clr_eos,                   "clear to end of screen (P*)"),
    TermCapability(:hpa,      :column_address,            "horizontal position #1, absolute (P)"),
    TermCapability(:cmdch,    :command_character,         "terminal settable cmd character in prototype !?"),
    TermCapability(:cup,      :cursor_address,            "move to row #1 columns #2"),
    TermCapability(:cud1,     :cursor_down,               "down one line"),
    TermCapability(:home,     :cursor_home,               "home cursor (if no cup)"),
    TermCapability(:civis,    :cursor_invisible,          "make cursor invisible"),
    TermCapability(:cub1,     :cursor_left,               "move left one space"),
    TermCapability(:mrcup,    :cursor_mem_address,        "memory relative cursor addressing, move to row #1 columns #2"),
    TermCapability(:cnorm,    :cursor_normal,             "make cursor appear normal (undo civis/cvvis)"),
    TermCapability(:cuf1,     :cursor_right,              "non-destructive space (move right one space)"),
    TermCapability(:ll,       :cursor_to_ll,              "last line, first column (if no cup)"),
    TermCapability(:cuu1,     :cursor_up,                 "up one line"),
    TermCapability(:cvvis,    :cursor_visible,            "make cursor very visible"),
    TermCapability(:dch1,     :delete_character,          "delete character (P*)"),
    TermCapability(:dl1,      :delete_line,               "delete line (P*)"),
    TermCapability(:dsl,      :dis_status_line,           "disable status line"),
    TermCapability(:hd,       :down_half_line,            "half a line down"),
    TermCapability(:smacs,    :enter_alt_charset_mode,    "start alternate character set (P)"),
    TermCapability(:blink,    :enter_blink_mode,          "turn on blinking"),
    TermCapability(:bold,     :enter_bold_mode,           "turn on bold (extra bright) mode"),
    TermCapability(:smcup,    :enter_ca_mode,             "string to start programs using cup"),
    TermCapability(:smdc,     :enter_delete_mode,         "enter delete mode"),
    TermCapability(:dim,      :enter_dim_mode,            "turn on half-bright mode"),
    TermCapability(:smir,     :enter_insert_mode,         "enter insert mode"),
    TermCapability(:invis,    :enter_secure_mode,         "turn on blank mode (characters invisible)"),
    TermCapability(:prot,     :enter_protected_mode,      "turn on protected mode"),
    TermCapability(:rev,      :enter_reverse_mode,        "turn on reverse video mode"),
    TermCapability(:smso,     :enter_standout_mode,       "begin standout mode"),
    TermCapability(:smul,     :enter_underline_mode,      "begin underline mode"),
    TermCapability(:ech,      :erase_chars,               "erase #1 characters (P)"),
    TermCapability(:rmacs,    :exit_alt_charset_mode,     "end alternate character set (P)"),
    TermCapability(:sgr0,     :exit_attribute_mode,       "turn off all attributes"),
    TermCapability(:rmcup,    :exit_ca_mode,              "strings to end programs using cup"),
    TermCapability(:rmdc,     :exit_delete_mode,          "end delete mode"),
    TermCapability(:rmir,     :exit_insert_mode,          "exit insert mode"),
    TermCapability(:rmso,     :exit_standout_mode,        "exit standout mode"),
    TermCapability(:rmul,     :exit_underline_mode,       "exit underline mode"),
    TermCapability(:flash,    :flash_screen,              "visible bell (may not move cursor)"),
    TermCapability(:ff,       :form_feed,                 "hardcopy terminal page eject (P*)"),
    TermCapability(:fsl,      :from_status_line,          "return from status line"),
    TermCapability(:is1,      :init_1string,              "initialization string"),
    TermCapability(:is2,      :init_2string,              "initialization string"),
    TermCapability(:is3,      :init_3string,              "initialization string"),
    TermCapability(:if,       :init_file,                 "name of initialization file"),
    TermCapability(:ich1,     :insert_character,          "insert character (P)"),
    TermCapability(:il1,      :insert_line,               "insert line (P*)"),
    TermCapability(:ip,       :insert_padding,            "insert padding after inserted character"),
    TermCapability(:kbs,      :key_backspace,             "backspace key"),
    TermCapability(:ktbc,     :key_catab,                 "clear-all-tabs key"),
    TermCapability(:kclr,     :key_clear,                 "clear-screen or erase key"),
    TermCapability(:kctab,    :key_ctab,                  "clear-tab key"),
    TermCapability(:kdch1,    :key_dc,                    "delete-character key"),
    TermCapability(:kdl1,     :key_dl,                    "delete-line key"),
    TermCapability(:kcud1,    :key_down,                  "down-arrow key"),
    TermCapability(:krmir,    :key_eic,                   "sent by rmir or smir in insert mode"),
    TermCapability(:kel,      :key_eol,                   "clear-to-end-of-line key"),
    TermCapability(:ked,      :key_eos,                   "clear-to-end-of-screen key"),
    TermCapability(:kf0,      :key_f0,                    "F0 function key"),
    TermCapability(:kf1,      :key_f1,                    "F1 function key"),
    TermCapability(:kf10,     :key_f10,                   "F10 function key"),
    TermCapability(:kf2,      :key_f2,                    "F2 function key"),
    TermCapability(:kf3,      :key_f3,                    "F3 function key"),
    TermCapability(:kf4,      :key_f4,                    "F4 function key"),
    TermCapability(:kf5,      :key_f5,                    "F5 function key"),
    TermCapability(:kf6,      :key_f6,                    "F6 function key"),
    TermCapability(:kf7,      :key_f7,                    "F7 function key"),
    TermCapability(:kf8,      :key_f8,                    "F8 function key"),
    TermCapability(:kf9,      :key_f9,                    "F9 function key"),
    TermCapability(:khome,    :key_home,                  "home key"),
    TermCapability(:kich1,    :key_ic,                    "insert-character key"),
    TermCapability(:kil1,     :key_il,                    "insert-line key"),
    TermCapability(:kcub1,    :key_left,                  "left-arrow key"),
    TermCapability(:kll,      :key_ll,                    "lower-left key (home down)"),
    TermCapability(:knp,      :key_npage,                 "next-page key"),
    TermCapability(:kpp,      :key_ppage,                 "previous-page key"),
    TermCapability(:kcuf1,    :key_right,                 "right-arrow key"),
    TermCapability(:kind,     :key_sf,                    "scroll-forward key"),
    TermCapability(:kri,      :key_sr,                    "scroll-backward key"),
    TermCapability(:khts,     :key_stab,                  "set-tab key"),
    TermCapability(:kcuu1,    :key_up,                    "up-arrow key"),
    TermCapability(:rmkx,     :keypad_local,              "leave 'keyboard_transmit' mode"),
    TermCapability(:smkx,     :keypad_xmit,               "enter 'keyboard_transmit' mode"),
    TermCapability(:lf0,      :lab_f0,                    "label on function key f0 if not f0"),
    TermCapability(:lf1,      :lab_f1,                    "label on function key f1 if not f1"),
    TermCapability(:lf10,     :lab_f10,                   "label on function key f10 if not f10"),
    TermCapability(:lf2,      :lab_f2,                    "label on function key f2 if not f2"),
    TermCapability(:lf3,      :lab_f3,                    "label on function key f3 if not f3"),
    TermCapability(:lf4,      :lab_f4,                    "label on function key f4 if not f4"),
    TermCapability(:lf5,      :lab_f5,                    "label on function key f5 if not f5"),
    TermCapability(:lf6,      :lab_f6,                    "label on function key f6 if not f6"),
    TermCapability(:lf7,      :lab_f7,                    "label on function key f7 if not f7"),
    TermCapability(:lf8,      :lab_f8,                    "label on function key f8 if not f8"),
    TermCapability(:lf9,      :lab_f9,                    "label on function key f9 if not f9"),
    TermCapability(:rmm,      :meta_off,                  "turn off meta mode"),
    TermCapability(:smm,      :meta_on,                   "turn on meta mode (8th-bit on)"),
    TermCapability(:nel,      :newline,                   "newline (behave like cr followed by lf)"),
    TermCapability(:pad,      :pad_char,                  "padding char (instead of null)"),
    TermCapability(:dch,      :parm_dch,                  "delete #1 characters (P*)"),
    TermCapability(:dl,       :parm_delete_line,          "delete #1 lines (P*)"),
    TermCapability(:cud,      :parm_down_cursor,          "down #1 lines (P*)"),
    TermCapability(:ich,      :parm_ich,                  "insert #1 characters (P*)"),
    TermCapability(:indn,     :parm_index,                "scroll forward #1 lines (P)"),
    TermCapability(:il,       :parm_insert_line,          "insert #1 lines (P*)"),
    TermCapability(:cub,      :parm_left_cursor,          "move #1 characters to the left (P)"),
    TermCapability(:cuf,      :parm_right_cursor,         "move #1 characters to the right (P*)"),
    TermCapability(:rin,      :parm_rindex,               "scroll back #1 lines (P)"),
    TermCapability(:cuu,      :parm_up_cursor,            "up #1 lines (P*)"),
    TermCapability(:pfkey,    :pkey_key,                  "program function key #1 to type string #2"),
    TermCapability(:pfloc,    :pkey_local,                "program function key #1 to execute string #2"),
    TermCapability(:pfx,      :pkey_xmit,                 "program function key #1 to transmit string #2"),
    TermCapability(:mc0,      :print_screen,              "print contents of screen"),
    TermCapability(:mc4,      :prtr_off,                  "turn off printer"),
    TermCapability(:mc5,      :prtr_on,                   "turn on printer"),
    TermCapability(:rep,      :repeat_char,               "repeat char #1 #2 times (P*)"),
    TermCapability(:rs1,      :reset_1string,             "reset string"),
    TermCapability(:rs2,      :reset_2string,             "reset string"),
    TermCapability(:rs3,      :reset_3string,             "reset string"),
    TermCapability(:rf,       :reset_file,                "name of reset file"),
    TermCapability(:rc,       :restore_cursor,            "restore cursor to position of last save_cursor"),
    TermCapability(:vpa,      :row_address,               "vertical position #1 absolute (P)"),
    TermCapability(:sc,       :save_cursor,               "save current cursor position (P)"),
    TermCapability(:ind,      :scroll_forward,            "scroll text up (P)"),
    TermCapability(:ri,       :scroll_reverse,            "scroll text down (P)"),
    TermCapability(:sgr,      :set_attributes,            "define video attributes #1-#9 (PG9)"),
    TermCapability(:hts,      :set_tab,                   "set a tab in every row, current columns"),
    TermCapability(:wind,     :set_window,                "current window is lines #1-#2 cols #3-#4"),
    TermCapability(:ht,       :tab,                       "tab to next 8-space hardware tab stop"),
    TermCapability(:tsl,      :to_status_line,            "move to status line, column #1"),
    TermCapability(:uc,       :underline_char,            "underline char and move past it"),
    TermCapability(:hu,       :up_half_line,              "half a line up"),
    TermCapability(:iprog,    :init_prog,                 "path name of program for initialization"),
    TermCapability(:ka1,      :key_a1,                    "upper left of keypad"),
    TermCapability(:ka3,      :key_a3,                    "upper right of keypad"),
    TermCapability(:kb2,      :key_b2,                    "center of keypad"),
    TermCapability(:kc1,      :key_c1,                    "lower left of keypad"),
    TermCapability(:kc3,      :key_c3,                    "lower right of keypad"),
    TermCapability(:mc5p,     :prtr_non,                  "turn on printer for #1 bytes"),
    TermCapability(:rmp,      :char_padding,              "like ip but when in insert mode"),
    TermCapability(:acsc,     :acs_chars,                 "graphics charset pairs, based on vt100"),
    TermCapability(:pln,      :plab_norm,                 "program label #1 to show string #2"),
    TermCapability(:kcbt,     :key_btab,                  "back-tab key"),
    TermCapability(:smxon,    :enter_xon_mode,            "turn on xon/xoff handshaking"),
    TermCapability(:rmxon,    :exit_xon_mode,             "turn off xon/xoff handshaking"),
    TermCapability(:smam,     :enter_am_mode,             "turn on automatic margins"),
    TermCapability(:rmam,     :exit_am_mode,              "turn off automatic margins"),
    TermCapability(:xonc,     :xon_character,             "XON character"),
    TermCapability(:xoffc,    :xoff_character,            "XOFF character"),
    TermCapability(:enacs,    :ena_acs,                   "enable alternate char set"),
    TermCapability(:smln,     :label_on,                  "turn on soft labels"),
    TermCapability(:rmln,     :label_off,                 "turn off soft labels"),
    TermCapability(:kbeg,     :key_beg,                   "begin key"),
    TermCapability(:kcan,     :key_cancel,                "cancel key"),
    TermCapability(:kclo,     :key_close,                 "close key"),
    TermCapability(:kcmd,     :key_command,               "command key"),
    TermCapability(:kcpy,     :key_copy,                  "copy key"),
    TermCapability(:kcrt,     :key_create,                "create key"),
    TermCapability(:kend,     :key_end,                   "end key"),
    TermCapability(:kent,     :key_enter,                 "enter/send key"),
    TermCapability(:kext,     :key_exit,                  "exit key"),
    TermCapability(:kfnd,     :key_find,                  "find key"),
    TermCapability(:khlp,     :key_help,                  "help key"),
    TermCapability(:kmrk,     :key_mark,                  "mark key"),
    TermCapability(:kmsg,     :key_message,               "message key"),
    TermCapability(:kmov,     :key_move,                  "move key"),
    TermCapability(:knxt,     :key_next,                  "next key"),
    TermCapability(:kopn,     :key_open,                  "open key"),
    TermCapability(:kopt,     :key_options,               "options key"),
    TermCapability(:kprv,     :key_previous,              "previous key"),
    TermCapability(:kprt,     :key_print,                 "print key"),
    TermCapability(:krdo,     :key_redo,                  "redo key"),
    TermCapability(:kref,     :key_reference,             "reference key"),
    TermCapability(:krfr,     :key_refresh,               "refresh key"),
    TermCapability(:krpl,     :key_replace,               "replace key"),
    TermCapability(:krst,     :key_restart,               "restart key"),
    TermCapability(:kres,     :key_resume,                "resume key"),
    TermCapability(:ksav,     :key_save,                  "save key"),
    TermCapability(:kspd,     :key_suspend,               "suspend key"),
    TermCapability(:kund,     :key_undo,                  "undo key"),
    TermCapability(:kBEG,     :key_sbeg,                  "shifted begin key"),
    TermCapability(:kCAN,     :key_scancel,               "shifted cancel key"),
    TermCapability(:kCMD,     :key_scommand,              "shifted command key"),
    TermCapability(:kCPY,     :key_scopy,                 "shifted copy key"),
    TermCapability(:kCRT,     :key_screate,               "shifted create key"),
    TermCapability(:kDC,      :key_sdc,                   "shifted delete-character key"),
    TermCapability(:kDL,      :key_sdl,                   "shifted delete-line key"),
    TermCapability(:kslt,     :key_select,                "select key"),
    TermCapability(:kEND,     :key_send,                  "shifted end key"),
    TermCapability(:kEOL,     :key_seol,                  "shifted clear-to-end-of-line key"),
    TermCapability(:kEXT,     :key_sexit,                 "shifted exit key"),
    TermCapability(:kFND,     :key_sfind,                 "shifted find key"),
    TermCapability(:kHLP,     :key_shelp,                 "shifted help key"),
    TermCapability(:kHOM,     :key_shome,                 "shifted home key"),
    TermCapability(:kIC,      :key_sic,                   "shifted insert-character key"),
    TermCapability(:kLFT,     :key_sleft,                 "shifted left-arrow key"),
    TermCapability(:kMSG,     :key_smessage,              "shifted message key"),
    TermCapability(:kMOV,     :key_smove,                 "shifted move key"),
    TermCapability(:kNXT,     :key_snext,                 "shifted next key"),
    TermCapability(:kOPT,     :key_soptions,              "shifted options key"),
    TermCapability(:kPRV,     :key_sprevious,             "shifted previous key"),
    TermCapability(:kPRT,     :key_sprint,                "shifted print key"),
    TermCapability(:kRDO,     :key_sredo,                 "shifted redo key"),
    TermCapability(:kRPL,     :key_sreplace,              "shifted replace key"),
    TermCapability(:kRIT,     :key_sright,                "shifted right-arrow key"),
    TermCapability(:kRES,     :key_srsume,                "shifted resume key"),
    TermCapability(:kSAV,     :key_ssave,                 "shifted save key"),
    TermCapability(:kSPD,     :key_ssuspend,              "shifted suspend key"),
    TermCapability(:kUND,     :key_sundo,                 "shifted undo key"),
    TermCapability(:rfi,      :req_for_input,             "send next input char (for ptys)"),
    TermCapability(:kf11,     :key_f11,                   "F11 function key"),
    TermCapability(:kf12,     :key_f12,                   "F12 function key"),
    TermCapability(:kf13,     :key_f13,                   "F13 function key"),
    TermCapability(:kf14,     :key_f14,                   "F14 function key"),
    TermCapability(:kf15,     :key_f15,                   "F15 function key"),
    TermCapability(:kf16,     :key_f16,                   "F16 function key"),
    TermCapability(:kf17,     :key_f17,                   "F17 function key"),
    TermCapability(:kf18,     :key_f18,                   "F18 function key"),
    TermCapability(:kf19,     :key_f19,                   "F19 function key"),
    TermCapability(:kf20,     :key_f20,                   "F20 function key"),
    TermCapability(:kf21,     :key_f21,                   "F21 function key"),
    TermCapability(:kf22,     :key_f22,                   "F22 function key"),
    TermCapability(:kf23,     :key_f23,                   "F23 function key"),
    TermCapability(:kf24,     :key_f24,                   "F24 function key"),
    TermCapability(:kf25,     :key_f25,                   "F25 function key"),
    TermCapability(:kf26,     :key_f26,                   "F26 function key"),
    TermCapability(:kf27,     :key_f27,                   "F27 function key"),
    TermCapability(:kf28,     :key_f28,                   "F28 function key"),
    TermCapability(:kf29,     :key_f29,                   "F29 function key"),
    TermCapability(:kf30,     :key_f30,                   "F30 function key"),
    TermCapability(:kf31,     :key_f31,                   "F31 function key"),
    TermCapability(:kf32,     :key_f32,                   "F32 function key"),
    TermCapability(:kf33,     :key_f33,                   "F33 function key"),
    TermCapability(:kf34,     :key_f34,                   "F34 function key"),
    TermCapability(:kf35,     :key_f35,                   "F35 function key"),
    TermCapability(:kf36,     :key_f36,                   "F36 function key"),
    TermCapability(:kf37,     :key_f37,                   "F37 function key"),
    TermCapability(:kf38,     :key_f38,                   "F38 function key"),
    TermCapability(:kf39,     :key_f39,                   "F39 function key"),
    TermCapability(:kf40,     :key_f40,                   "F40 function key"),
    TermCapability(:kf41,     :key_f41,                   "F41 function key"),
    TermCapability(:kf42,     :key_f42,                   "F42 function key"),
    TermCapability(:kf43,     :key_f43,                   "F43 function key"),
    TermCapability(:kf44,     :key_f44,                   "F44 function key"),
    TermCapability(:kf45,     :key_f45,                   "F45 function key"),
    TermCapability(:kf46,     :key_f46,                   "F46 function key"),
    TermCapability(:kf47,     :key_f47,                   "F47 function key"),
    TermCapability(:kf48,     :key_f48,                   "F48 function key"),
    TermCapability(:kf49,     :key_f49,                   "F49 function key"),
    TermCapability(:kf50,     :key_f50,                   "F50 function key"),
    TermCapability(:kf51,     :key_f51,                   "F51 function key"),
    TermCapability(:kf52,     :key_f52,                   "F52 function key"),
    TermCapability(:kf53,     :key_f53,                   "F53 function key"),
    TermCapability(:kf54,     :key_f54,                   "F54 function key"),
    TermCapability(:kf55,     :key_f55,                   "F55 function key"),
    TermCapability(:kf56,     :key_f56,                   "F56 function key"),
    TermCapability(:kf57,     :key_f57,                   "F57 function key"),
    TermCapability(:kf58,     :key_f58,                   "F58 function key"),
    TermCapability(:kf59,     :key_f59,                   "F59 function key"),
    TermCapability(:kf60,     :key_f60,                   "F60 function key"),
    TermCapability(:kf61,     :key_f61,                   "F61 function key"),
    TermCapability(:kf62,     :key_f62,                   "F62 function key"),
    TermCapability(:kf63,     :key_f63,                   "F63 function key"),
    TermCapability(:el1,      :clr_bol,                   "Clear to beginning of line"),
    TermCapability(:mgc,      :clear_margins,             "clear right and left soft margins"),
    TermCapability(:smgl,     :set_left_margin,           "set left soft margin at current column. (ML is not in BSD termcap)."),
    TermCapability(:smgr,     :set_right_margin,          "set right soft margin at current column"),
    TermCapability(:fln,      :label_format,              "label format"),
    TermCapability(:sclk,     :set_clock,                 "set clock, #1 hrs #2 mins #3 secs"),
    TermCapability(:dclk,     :display_clock,             "display clock"),
    TermCapability(:rmclk,    :remove_clock,              "remove clock"),
    TermCapability(:cwin,     :create_window,             "define a window #1 from #2, #3 to #4, #5"),
    TermCapability(:wingo,    :goto_window,               "go to window #1"),
    TermCapability(:hup,      :hangup,                    "hang-up phone"),
    TermCapability(:dial,     :dial_phone,                "dial number #1"),
    TermCapability(:qdial,    :quick_dial,                "dial number #1 without checking"),
    TermCapability(:tone,     :tone,                      "select touch tone dialing"),
    TermCapability(:pulse,    :pulse,                     "select pulse dialing"),
    TermCapability(:hook,     :flash_hook,                "flash switch hook"),
    TermCapability(:pause,    :fixed_pause,               "pause for 2-3 seconds"),
    TermCapability(:wait,     :wait_tone,                 "wait for dial-tone"),
    TermCapability(:u0,       :user0,                     "User string #0"),
    TermCapability(:u1,       :user1,                     "User string #1"),
    TermCapability(:u2,       :user2,                     "User string #2"),
    TermCapability(:u3,       :user3,                     "User string #3"),
    TermCapability(:u4,       :user4,                     "User string #4"),
    TermCapability(:u5,       :user5,                     "User string #5"),
    TermCapability(:u6,       :user6,                     "User string #6"),
    TermCapability(:u7,       :user7,                     "User string #7"),
    TermCapability(:u8,       :user8,                     "User string #8"),
    TermCapability(:u9,       :user9,                     "User string #9"),
    TermCapability(:op,       :orig_pair,                 "Set default pair to its original value"),
    TermCapability(:oc,       :orig_colors,               "Set all color pairs to the original ones"),
    TermCapability(:initc,    :initialize_color,          "Initialize color #1 to (#2, #3, #4)"),
    TermCapability(:initp,    :initialize_pair,           "Initialize color pair #1 to fg=(#2, #3, #4), bg=(#5,#6,#7)"),
    TermCapability(:scp,      :set_color_pair,            "Set current color pair to #1"),
    TermCapability(:setf,     :set_foreground,            "Set foreground color #1"),
    TermCapability(:setb,     :set_background,            "Set background color #1"),
    TermCapability(:cpi,      :change_char_pitch,         "Change number of characters per inch to #1"),
    TermCapability(:lpi,      :change_line_pitch,         "Change number of lines per inch to #1"),
    TermCapability(:chr,      :change_res_horz,           "Change horizontal resolution to #1"),
    TermCapability(:cvr,      :change_res_vert,           "Change vertical resolution to #1"),
    TermCapability(:defc,     :define_char,               "Define a character #1, #2 dots wide, descender #3"),
    TermCapability(:swidm,    :enter_doublewide_mode,     "Enter double-wide mode"),
    TermCapability(:sdrfq,    :enter_draft_quality,       "Enter draft-quality mode"),
    TermCapability(:sitm,     :enter_italics_mode,        "Enter italic mode"),
    TermCapability(:slm,      :enter_leftward_mode,       "Start leftward carriage motion"),
    TermCapability(:smicm,    :enter_micro_mode,          "Start micro-motion mode"),
    TermCapability(:snlq,     :enter_near_letter_quality, "Enter NLQ mode"),
    TermCapability(:snrmq,    :enter_normal_quality,      "Enter normal-quality mode"),
    TermCapability(:sshm,     :enter_shadow_mode,         "Enter shadow-print mode"),
    TermCapability(:ssubm,    :enter_subscript_mode,      "Enter subscript mode"),
    TermCapability(:ssupm,    :enter_superscript_mode,    "Enter superscript mode"),
    TermCapability(:sum,      :enter_upward_mode,         "Start upward carriage motion"),
    TermCapability(:rwidm,    :exit_doublewide_mode,      "End double-wide mode"),
    TermCapability(:ritm,     :exit_italics_mode,         "End italic mode"),
    TermCapability(:rlm,      :exit_leftward_mode,        "End left-motion mode"),
    TermCapability(:rmicm,    :exit_micro_mode,           "End micro-motion mode"),
    TermCapability(:rshm,     :exit_shadow_mode,          "End shadow-print mode"),
    TermCapability(:rsubm,    :exit_subscript_mode,       "End subscript mode"),
    TermCapability(:rsupm,    :exit_superscript_mode,     "End superscript mode"),
    TermCapability(:rum,      :exit_upward_mode,          "End reverse character motion"),
    TermCapability(:mhpa,     :micro_column_address,      "Like column_address in micro mode"),
    TermCapability(:mcud1,    :micro_down,                "Like cursor_down in micro mode"),
    TermCapability(:mcub1,    :micro_left,                "Like cursor_left in micro mode"),
    TermCapability(:mcuf1,    :micro_right,               "Like cursor_right in micro mode"),
    TermCapability(:mvpa,     :micro_row_address,         "Like row_address #1 in micro mode"),
    TermCapability(:mcuu1,    :micro_up,                  "Like cursor_up in micro mode"),
    TermCapability(:porder,   :order_of_pins,             "Match software bits to print-head pins"),
    TermCapability(:mcud,     :parm_down_micro,           "Like parm_down_cursor in micro mode"),
    TermCapability(:mcub,     :parm_left_micro,           "Like parm_left_cursor in micro mode"),
    TermCapability(:mcuf,     :parm_right_micro,          "Like parm_right_cursor in micro mode"),
    TermCapability(:mcuu,     :parm_up_micro,             "Like parm_up_cursor in micro mode"),
    TermCapability(:scs,      :select_char_set,           "Select character set, #1"),
    TermCapability(:smgb,     :set_bottom_margin,         "Set bottom margin at current line"),
    TermCapability(:smgbp,    :set_bottom_margin_parm,    "Set bottom margin at line #1 or (if smgtp is not given) #2 lines from bottom"),
    TermCapability(:smglp,    :set_left_margin_parm,      "Set left (right) margin at column #1"),
    TermCapability(:smgrp,    :set_right_margin_parm,     "Set right margin at column #1"),
    TermCapability(:smgt,     :set_top_margin,            "Set top margin at current line"),
    TermCapability(:smgtp,    :set_top_margin_parm,       "Set top (bottom) margin at row #1"),
    TermCapability(:sbim,     :start_bit_image,           "Start printing bit image graphics"),
    TermCapability(:scsd,     :start_char_set_def,        "Start character set definition #1, with #2 characters in the set"),
    TermCapability(:rbim,     :stop_bit_image,            "Stop printing bit image graphics"),
    TermCapability(:rcsd,     :stop_char_set_def,         "End definition of character set #1"),
    TermCapability(:subcs,    :subscript_characters,      "List of subscriptable characters"),
    TermCapability(:supcs,    :superscript_characters,    "List of superscriptable characters"),
    TermCapability(:docr,     :these_cause_cr,            "Printing any of these characters causes CR"),
    TermCapability(:zerom,    :zero_motion,               "No motion for subsequent character"),
    TermCapability(:csnm,     :char_set_names,            "Produce #1'th item from list of character set names"),
    TermCapability(:kmous,    :key_mouse,                 "Mouse event has occurred"),
    TermCapability(:minfo,    :mouse_info,                "Mouse status information"),
    TermCapability(:reqmp,    :req_mouse_pos,             "Request mouse position"),
    TermCapability(:getm,     :get_mouse,                 "Curses should get button events, parameter #1 not documented."),
    TermCapability(:setaf,    :set_a_foreground,          "Set foreground color to #1, using ANSI escape"),
    TermCapability(:setab,    :set_a_background,          "Set background color to #1, using ANSI escape"),
    TermCapability(:pfxl,     :pkey_plab,                 "Program function key #1 to type string #2 and show string #3"),
    TermCapability(:devt,     :device_type,               "Indicate language/codeset support"),
    TermCapability(:csin,     :code_set_init,             "Init sequence for multiple codesets"),
    TermCapability(:s0ds,     :set0_des_seq,              "Shift to codeset 0 (EUC set 0, ASCII)"),
    TermCapability(:s1ds,     :set1_des_seq,              "Shift to codeset 1"),
    TermCapability(:s2ds,     :set2_des_seq,              "Shift to codeset 2"),
    TermCapability(:s3ds,     :set3_des_seq,              "Shift to codeset 3"),
    TermCapability(:smglr,    :set_lr_margin,             "Set both left and right margins to #1, #2. (ML is not in BSD termcap)."),
    TermCapability(:smgtb,    :set_tb_margin,             "Sets both top and bottom margins to #1, #2"),
    TermCapability(:birep,    :bit_image_repeat,          "Repeat bit image cell #1 #2 times"),
    TermCapability(:binel,    :bit_image_newline,         "Move to next row of the bit image"),
    TermCapability(:bicr,     :bit_image_carriage_return, "Move to beginning of same row"),
    TermCapability(:colornm,  :color_names,               "Give name for color #1"),
    TermCapability(:defbi,    :define_bit_image_region,   "Define rectangular bit image region"),
    TermCapability(:endbi,    :end_bit_image_region,      "End a bit-image region"),
    TermCapability(:setcolor, :set_color_band,            "Change to ribbon color #1"),
    TermCapability(:slines,   :set_page_length,           "Set page length to #1 lines"),
    TermCapability(:dispc,    :display_pc_char,           "Display PC character #1"),
    TermCapability(:smpch,    :enter_pc_charset_mode,     "Enter PC character display mode"),
    TermCapability(:rmpch,    :exit_pc_charset_mode,      "Exit PC character display mode"),
    TermCapability(:smsc,     :enter_scancode_mode,       "Enter PC scancode mode"),
    TermCapability(:rmsc,     :exit_scancode_mode,        "Exit PC scancode mode"),
    TermCapability(:pctrm,    :pc_term_options,           "PC terminal options"),
    TermCapability(:scesc,    :scancode_escape,           "Escape for scancode emulation"),
    TermCapability(:scesa,    :alt_scancode_esc,          "Alternate escape for scancode emulation"),
    TermCapability(:ehhlm,    :enter_horizontal_hl_mode,  "Enter horizontal highlight mode"),
    TermCapability(:elhlm,    :enter_left_hl_mode,        "Enter left highlight mode"),
    TermCapability(:elohlm,   :enter_low_hl_mode,         "Enter low highlight mode"),
    TermCapability(:erhlm,    :enter_right_hl_mode,       "Enter right highlight mode"),
    TermCapability(:ethlm,    :enter_top_hl_mode,         "Enter top highlight mode"),
    TermCapability(:evhlm,    :enter_vertical_hl_mode,    "Enter vertical highlight mode"),
    TermCapability(:sgr1,     :set_a_attributes,          "Define second set of video attributes #1-#6"),
    TermCapability(:slength,  :set_pglen_inch,            "Set page length to #1 hundredth of an inch (some implementations use sL for termcap)."),
    TermCapability(:OTi2,     :termcap_init2,             "secondary initialization string"),
    TermCapability(:OTrs,     :termcap_reset,             "terminal reset string"),
    TermCapability(:OTnl,     :linefeed_if_not_lf,        "use to move down"),
    TermCapability(:OTbs,     :backspaces_with_bs,        "uses ^H to move left"),
    TermCapability(:OTko,     :other_non_function_keys,   "list of self-mapped keycaps"),
    TermCapability(:OTma,     :arrow_key_map,             "map motion-keys for vi version 2"),
    TermCapability(:OTG2,     :acs_ulcorner,              "single upper left"),
    TermCapability(:OTG3,     :acs_llcorner,              "single lower left"),
    TermCapability(:OTG1,     :acs_urcorner,              "single upper right"),
    TermCapability(:OTG4,     :acs_lrcorner,              "single lower right"),
    TermCapability(:OTGR,     :acs_ltee,                  "tee pointing right"),
    TermCapability(:OTGL,     :acs_rtee,                  "tee pointing left"),
    TermCapability(:OTGU,     :acs_btee,                  "tee pointing up"),
    TermCapability(:OTGD,     :acs_ttee,                  "tee pointing down"),
    TermCapability(:OTGH,     :acs_hline,                 "single horizontal line"),
    TermCapability(:OTGV,     :acs_vline,                 "single vertical line"),
    TermCapability(:OTGC,     :acs_plus,                  "single intersection"),
    TermCapability(:meml,     :memory_lock,               "lock memory above cursor"),
    TermCapability(:memu,     :memory_unlock,             "unlock memory"),
    TermCapability(:box1,     :box_chars_1,               "box characters primary set"),
]
